#pragma once
#include "Stats.h"
#define GLM_SWIZZLE		//enable swizzling
#include "glm/glm.hpp"
#include "glm/gtc/matrix_transform.hpp"
using namespace glm;
#include "ShaderCollection.h"
#include "Ray.h"
#include "Intersection.h"

class Shape{
public:
	Shape(vec4 _pos, vec3 _rot);

	~Shape();

	vec4 position();
	void position(vec4 _pos);

	vec3 rotation();
	void rotation(vec3 _rot);

	float scale();
	void scale(float);

	ShaderCollection* shader();
	void shader(ShaderCollection*);

	//if there's an intersection, return true and set the _dist value
	//otherwise, return false
	virtual bool intersect(Intersection &_int){ printf("I'm taking over here\n"); return false; }
	//virtual bool intersect(Ray _theRay, float &_dist) = 0;

	//get the color of this shape where the ray intersects
	virtual vec4 getColor(Intersection &_int){ printf("I'm taking over the color here\n");  return vec4(0, 0, 0, 0); }
	//virtual vec4 getColor(Ray _theRay) = 0;

	virtual vec3 getMaxBound(){ printf("I'm taking over the max bounds here\n"); return vec3(0, 0, 0); }
	virtual vec3 getMinBound(){ printf("I'm taking over the min bounds here\n"); return vec3(0, 0, 0); }

	virtual vec3 getCenter(){ printf("I'm taking over the center here\n"); return vec3(0, 0, 0); }	//get the geometric center of the object

	virtual bool isBounded(){ printf("I'm taking over the boundedness here\n"); return false; }		//whether it can fit inside a bounding box

	static bool compare_xCenter(Shape* _first, Shape* _second){
		return _first->getCenter().x < _second->getCenter().x;
	}
	static bool compare_yCenter(Shape* _first, Shape* _second){
		return _first->getCenter().y < _second->getCenter().y;
	}
	static bool compare_zCenter(Shape* _first, Shape* _second){
		return _first->getCenter().z < _second->getCenter().z;
	}

protected:
	//position
	vec4 pos;
	//rotation
	vec3 rot;
	//scale
	float sc;

	mat4 modelviewMat;
	mat4 invModelviewMat;

	void updateModelViewMat();

	//surface shader
	ShaderCollection* shade;
private:

};

